import axios from 'axios'

const http = axios.create({
  baseURL: 'http://1.117.75.96:8888/'
})

http.interceptors.request.use(
  (config) => {
    if (localStorage.getItem('token')) {
      config.headers.token = localStorage.getItem('token')
    }
    return config
  },
  (err) => Promise.reject(err)
)

http.interceptors.response.use(
  (res) => {
    return res
  },
  (err) => Promise.reject(err)
)

export default http
